// 部门相关接口
import request from '@/utils/request'

/**
 *
 * @returns 查询企业的部门列表
 */
export const getDepartment = () => {
  return request.get('/company/department')
}

export function delDepartmentAPI(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
/**
 *
 * @param { name: '',code: '',manager: ''introduce: ''}
 * @returns 添加子部门
 */
export function addDepartmentAPI(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}
/**
 *
 * @param {*} id 部门ID
 * @returns
 */
// 根据id查询部门的详情
export function getDepartmentDetailAPI(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
/**
 *
 * @param {*} data
 * @returns 根据ID修改部门详情
 */
export function reqUpdateDepartmentsAPI(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 *
 * @param {*} id
 * @returns  根据 id 获取企业信息
 */
export const reqGetCompanyByIdAPI = (id) => {
  return request({
    method: 'get',
    url: `/company/${id}`
  })
}
